package oagrc.portal.view.security;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class PathMatcher {

    private final Pattern pattern;
    
    
    public PathMatcher(String pathPattern) {
        
        pattern = Pattern.compile(pathPattern.replace("*", ".*"));
    }
    
    public boolean match(String src) {

        boolean found = false;        
        Matcher m = pattern.matcher(src);
        if (m.find()) {
          found = (m.start() == 0 && m.end() == src.length());
        }
        return found;
    }
    
    public static void main(String[] args) {
        
        System.out.println("jamona".replace("a", ".a"));
    }
}
